/*
 *      debug.c
 *      
 *      Copyright 2009 Daniele Ricci <denn86@gmail.com>, Luca Saccagi <luksak86@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#ifndef _DEBUGF_IMPL
#define _DEBUGF_IMPL

#include "debug.h"

#ifdef _WIN32
static void print_conf(conf *configuration){
#else
void print_conf(conf *configuration){
#endif
	printf("\nIDMP CONFIGURATION\n");
	printf("USER:_______%s_____\n",c0->usr);
	printf("PASSWORD:___%s_____\n",c0->pw);
	printf("CERT_LOC:___%s_____\n",c0->certificate);
	printf("CERT_KEY:___%s_____\n\n",c0->certificate_key);
	printf("DIR-HPSIG:__%s_____\n",c0->dir_hpsign);
	printf("DIR-REACT:__%s_____\n\n",c0->dir_react);
	printf("DIR-SEND:___%s_____\n\n",c0->dir_send);
	printf("DIR-SIGN:___%s_____\n\n",c0->dir_sign);
	printf("DTD-SIGN:___%s_____\n\n",c0->dtd_sign);
	printf("GRP-FILE:___%s_____\n\n",c0->groups_file);
	printf("IP:_________%s_____\n",c0->srv_ip);
	printf("PORT:_______%s_____\n\n",c0->srv_port);
	printf("POL_TIME:___%d_____\n",c0->polling_time);
	printf("READ_RETR:__%d_____\n",c0->read_retries);
	printf("MAX-HENT:___%d_____\n\n",c0->max_hash_entry);
	getchar();
}


#ifdef _WIN32
static void HashItemPrint(void *payload,void *data,xmlChar *name){
#else
void HashItemPrint(void *payload,void *data,xmlChar *name){
#endif
	printf("DBG - Tabella %s:\n",(char *)name);
	xmlHashScan((xmlHashTablePtr)payload,hash_print,"f");
}	


#ifdef _WIN32
static void hash_print(void *payload,void *data,xmlChar *name){
#else
void hash_print(void *payload,void *data,xmlChar *name){
#endif
	printf("\tNAME:_%s_\n",(char *)name);
	if(data!=NULL){
		printf("\tPAYLOAD:_%s_\n",(char *)payload);
	}
}


#ifdef _WIN32
static void debugprintf(int level,char *str){
#else
void debugprintf(int level,char *str){
#endif
	if(DEBUG>=level){
		printf("%s\n",str);
	}
}


#endif